
<%@page import="study.itwill.team5.board.BoardCategoryItem"%>
<%@page import="study.itwill.team5.board.BoardCategory"%>
<%@page import="study.itwill.common.PatternChecker"%>
<%@page import="study.itwill.common.DBHandler"%>


<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%
	String seq = request.getParameter("seq");

	
	if (!PatternChecker.isValue(seq)) {
		out.print("<script type='text/javascript'>alert('뷰 파라미터가 없습니다.'); history.back();</script>");
		return;
	}
	if (!PatternChecker.isNum(seq)) {
		out.print("<script type='text/javascript'>alert('뷰 파라미터 입력이 잘못됐습니다.'); history.back();</script>");
		return;
	}

	int BoardCategory_number = Integer.parseInt(seq);
%>
<%@include file="../dbcon.jsp"%>
<%
	
	BoardCategory boca = new BoardCategory();
	BoardCategoryItem item = boca
			.viewBoardCategory(BoardCategory_number);

	

	if (item == null) {
		out.print("<script type='text/javascript'>alert('데이터 조회 실패입니다. 잠시 후 다시 시도해 주세요.'); history.back();</script>");
		return;

	}
%>
<!DOCTYPE html>
<html lang="ko">
<head>

<%@include file="../head.jsp"%>

</head>

<body>
	<%@include file="../menu.jsp"%>
	<%DBHandler.disconnect();%>
	<!-- 메뉴바 -->
	<div class="container">
		<div class="page-header">
			<h1>카테고리 정보 보기</h1>
		</div>


		<form id="frmBoardCategoryView" class="form-horizontal" role="form"
			method="post" action="">
			
			<input type="hidden" name="seq" value="<%=seq%>">
			<fieldset>

				<!--입력양식 -->
				<div class="form-group">
					<label for="category_name" class="col-md-2 control-label">카테고리 이름</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getCategory_name()%></p>
					</div>
				</div>
				
					<div class="form-group">
					<label for="reg_date" class="col-md-2 control-label">등록일자</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getReg_date()%></p>
					</div>
				</div>
				
					<div class="form-group">
					<label for="edit_date" class="col-md-2 control-label">수정일자</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getEdit_date()%></p>
					</div>
				</div>
				

				
				<div class="form-group">
					<div class="col-md-offset-2 col-md-10">
						<div class="row">
							<div class="col-md-4">
								<a href="listBoardCategory.jsp" class="btn btn-primary btn-block">목록보기</a>
							</div>
							<div class="col-md-4">
								<button type="submit" id="edit" formaction="editBoardCategory.jsp"
									formmethod="post"
									class="btn btn-info btn-block">수정하기</button>
							</div>
							<div class="col-md-4">
								<button type="submit" id="delete" 
								formaction="deletBoardCategoryOk.jsp" 
								formmethod="post"
								class="btn btn-danger btn-block">삭제하기</button>
							</div>
						</div>
					</div>
				</div>

			</fieldset>

		</form>

	</div>

	<!-- Javascript -->
	<script src="/italia/assets/js/jquery.js"></script>
	<script src="/italia/assets/js/bootstrap.min.js"></script>
 
	<script type="text/javascript">
		$(function() {
			// id속성이 "delete"인 요소에 대한 click이벤트
			$("#delete").click(function() {
				if(!confirm("정말 삭제하시겠습니까?")) {
					//취소를 선택한 경우 처리 중단
					return false;
				}
			});
		});
		
			</script>
  </body>
</html>